package com.Home.digital_life;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.GridView;
import android.widget.ImageView;

public class ImageAdapter extends BaseAdapter {
	private Context mContext;
	private Integer[] mImageIds = { R.drawable.music, R.drawable.video,
			R.drawable.people, R.drawable.message, R.drawable.update,
			R.drawable.set, R.drawable.about, R.drawable.exit, };

	public ImageAdapter(Context c) {
		mContext = c;
	}

	//
	public int getCount() {
		return mImageIds.length;
	}

	//
	public Object getItem(int position) {
		return position;
	}

	//
	public long getItemId(int position) {
		return position;
	}

	public View getView(int position, View convertView, ViewGroup parent) {
		ImageView imageView;
		if (convertView == null) {
			//
			imageView = new ImageView(mContext);
			//
			imageView.setLayoutParams(new GridView.LayoutParams(85, 85));
			//
			imageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
		} else {
			imageView = (ImageView) convertView;
		}

		imageView.setImageResource(mImageIds[position]);
		return imageView;
	}

}
